<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width"/>
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>方向详情</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/main.css" />
    <link rel="stylesheet" type="text/css" href="../../css/myDevelop.css" />
</head>
<body>
  <div id="header">
      <div id="back"></div>
      <h3>立即报名</h3>
  </div>
  <div id="all">
    <div class="enList" id="enList">
      <div class="enroll" >
        <div class="mine">
          <img class="left" src="../../image/boy1.jpg"/>
          <div class="right">
            <div><span>李某某</span><span>软件101</span></div>
            <div><span>联系方式</span><span>13557724558</span></div>
            <div><span>学号</span><span>398798379</span></div>
            <div><span>身份证号</span><span>555541454541</span></div>
          </div>
        </div>
        <div class="tableForm">
          <div class="title">请输入家庭信息</div>
          <div class="item"><span>家庭电话</span><span><input type="number" placeholder="请输入家庭电话" class="familyNum"/></span></div>
          <div class="item"><span>父亲电话</span><span><input type="number" placeholder="请输入父亲电话" class="fatherNum"/></span></div>
          <div class="item"><span>母亲电话</span><span><input type="number" placeholder="请输入母亲电话" class="motherNum"/></span></div>
          <div class="item"><span>家庭地址</span><span class="chooseCity">请选择</span></div>
          <div class="item"><span></span><span><input type="text" placeholder="请输入详细地址" style="text-indent:0" class="address"/></span></div>
        </div>
      </div>
      <div class="tools start">
         确认提交
      </div>
    </div>
  </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/jquery.js"></script>
<script type="text/javascript">
apiready=function(){
  var flag=$api.getStorage('flag');
  var aid=$api.getStorage('aid');
  $(".chooseCity").click(function(){
    //三级联动
    var citySelector = api.require('citySelector');
    citySelector.open({
        y: api.frameHeight / 1.6,
        fixedOn: api.frameName
    }, function(ret) {
        if (ret) {
            $(".chooseCity").html(ret.province+' '+ret.city+' '+ret.county)
        }
    });
  })

  $(".start").click(function(){
    //提交数据post
     var thisId=api.pageParam.thisId;
     console.log(thisId)
     var jwt=$api.getStorage('jwt');
     if($(".familyNum").val()!=''&&$(".fatherNum").val()!=''&&$(".motherNum").val()!=''&&$(".chooseCity").html()!='请选择'&&$(".address").val()!=''){
          var data="";
              api.ajax({
                url: 'http://47.104.170.122/v1/portal/training/student/selectDirection?directionId='+thisId+'&familyNo='+$(".familyNum").val()+'&fatherNo='+$(".fatherNum").val()+'&motherNo='+$(".motherNum").val()+'&address='+$(".chooseCity").html()+$(".address").val()+'&token='+jwt,
                method: 'POST',
                headers: {
                  "Access-Control-Allow-Origin": "*",
                  "Access-Control-Allow-Headers": "Authorization",
                  "Content-Type" : 'application/json; charset=utf-8'
                },
                data:{body:data}
              }, function(ret, err) {
                  if (ret.code==0){
                    api.alert({ msg: '提交成功' });
                    closeWin();
                  }else{
                    toast(ret.msg,"middle");
                  }
              });
       }else{
         toast("请完善信息","middle");
       }
  })
}
//jquery
$(function(){
  back();
})
</script>
<script type="text/javascript" src="../../script/main.js"></script>
</html>
